package com.example.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;
import org.springframework.util.unit.DataUnit;

import javax.servlet.MultipartConfigElement;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 2019/8/22 0:22
 */
@Configuration
public class Settings {

    @Bean
    public MultipartConfigElement multipartConfigElement(){
        MultipartConfigFactory factory = new MultipartConfigFactory();
        factory.setMaxFileSize(DataSize.of(100,DataUnit.MEGABYTES));
        factory.setMaxRequestSize(DataSize.of(100,DataUnit.MEGABYTES));
        return factory.createMultipartConfig();
    }

}
